package edu.bw.service.impl;

import edu.bw.dao.AccountDao;
import edu.bw.po.Account;
import edu.bw.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class AccountServiceImpl02 implements AccountService {

    @Autowired
    private AccountDao accountDao;

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public void transferAccount(Account transferInAccount, Account transferOutAccount) {

        accountDao.updateAccount(transferInAccount);
//        int i=1/0;
        accountDao.updateAccount(transferOutAccount);
    }
}
